<template>
  <!-- 客户搜索 -->
  <base-table-select v-model="customer" :disabled="disabled" placeholder="请选择客户" class="my-form_input" :api-obj="deviceObj" :params="params" :table-width="400" :props="deviceProps" @change="change">
    <el-table-column prop="name" label="客户" min-width="145" align="center" />
    <el-table-column prop="contactPhone" label="联系电话" width="145" align="center" />
  </base-table-select>
</template>

<script>
import { reqCondition } from '@/api/module/customer.js'
export default {
  props: {
    disabled: {
      type: Boolean,
      default: false
    },
    param: {
      type: Object,
      default: () => {
        return {}
      }
    },
    data: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      customer: {},
      deviceObj: reqCondition, // 设备列表请求接口
      deviceProps: {
        label: 'name',
        value: 'id',
        keyword: 'name',
        page: 'page',
        pageSize: 'size'
      },
      params: {
        valid: true,
        status: 'PASSED'

      }
    }
  },
  watch: {
    param: {
      handler() {
        Object.assign(this.params, this.param)
      },
      deep: true,
      immediate: true
    },
    data: {
      handler(val) {
        this.customer = Object.assign({}, this.customer, val)
      },
      deep: true,
      immediate: true
    }
  },
  methods: {
    change() {
      this.$emit('change', this.customer)
    },
    clear() {
      this.customer = {}
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
